package com.android.cs4274;

import java.io.IOException;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class Cs4274Activity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
		
		final DigitClientAPI test = new DigitClientAPI(Cs4274Activity.this, "hi");
		
    	Button button = (Button) findViewById(R.id.button1);
    	//Dialog dialog = (dialog) findViewById(R.id.)
		button.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				//test.onPreExecute();
				/*
				AlertDialog.Builder builder;
				AlertDialog alertDialog = null;

				Context mContext = getApplicationContext();
				LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
				View layout = inflater.inflate(R.layout.welcome_dialog,
				                               (ViewGroup) findViewById(R.id.welcome_layout));

				EditText username = (EditText) alertDialog.findViewById(R.id.username);
				EditText password = (EditText) alertDialog.findViewById(R.id.password);
				
				builder = new AlertDialog.Builder(mContext);
				builder.setView(layout);
				alertDialog = builder.create();
				 */
				
				
				AlertDialog alertDialog = new AlertDialog.Builder(Cs4274Activity.this).create();
				alertDialog.setMessage("Hello, this is a custom dialog!");
				alertDialog.setCanceledOnTouchOutside(true);
				alertDialog.setButton("Ok", new DialogInterface.OnClickListener(){
					public void onClick(DialogInterface dialog, int which) {
						//do nothing
						return;
					}

				});
				alertDialog.show();
			}
		});
    }
}